package WaiBao;

import java.util.Arrays;

public class ZaiGuoXing {
    public static void main(String[] args) {
        String[] name = {"吴琦(班长)", "李浩(副班长)", "小李(学习委员)", "李存勖(团支书)", "李茂良", "王子烨", "王麻子", "钟意", "李德东", "李戴", "张大大", "文君",
                "成龙", "何国秀", "文章", "何炅", "文号", "刘梅", "李思琪", "薇娅", "杜小兰", "李小春", "李静瑶", "胡橘芳", "王波", "刘佳", "沈霞", "彭海燕",
                "房祖名", "翟国鑫(学生)"};//考生本人:翟国鑫(学生)
        int[] age = {21, 21, 17, 18,20, 19, 21, 20, 20, 19,21, 20, 18, 20, 20, 19, 20, 20, 18, 18, 20, 19, 21, 20, 20, 18, 19, 19, 18,19};//考生年龄：19岁

        double[] edge1 = {64, 74, 84, 91, 79, 67, 78, 80, 80, 80, 91, 87, 82, 84, 65, 68, 99, 99, 96, 88, 92, 91, 95, 65, 75, 74, 94, 77, 80, 95};
        double[] edge2 = {85, 95, 69, 76, 78, 75, 74, 69, 94, 70, 80, 77, 66, 95, 65, 65, 76, 99, 66, 98, 72, 71, 95, 86, 75, 88, 84, 74, 88, 96};
        double[] edge3 = {89, 74, 84, 85, 77, 66, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 61, 81, 96};


        double tiwen1;//代表每个学生的总分
        double tiwen2;//代表每个学生的平均分
//        for (int i = 0; i < name.length; i++) {
//            System.out.println("姓名:"+name[i]+" "+"年龄:"+age[i]);
//        }
//        for (int i = 0; i < 30; i++) {
//            tiwen1 = edge1[i] + edge2[i] + edge3[i];
//            tiwen2 = (tiwen1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + tiwen1);
//            System.out.println(name[i] + "的平均分为:" + tiwen2);
//        }

        double shang1 = 0, shang2 = 0;
        double[] dudu = new double[30];
//        for (int i = 0; i < 30; i++) {
//            shang1 = edge1[i] + edge2[i] + edge3[i];
//            shang2 = (shang1 * 1.0) / 3;
//            dudu[i] = shang2;
//        }
//
//        for (int i = 0; i < dudu.length - 1; i++) {
//            for (int j = 0; j < dudu.length - i - 1; j++) {
//                if (dudu[j] <dudu[j + 1]) {
//                    double tep = dudu[j];
//                    dudu[j] = dudu[j + 1];
//                    dudu[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(dudu[i]);
//        }



        double kuka1 = 0, kuka2 = 0, kuka3 = 0;//计算每门课的平均分
        double moji1 = 0, moji2 = 0, moji3 = 0;//计算每门课标准差
        double diliu1 = 0,diliu2 = 0, diliu3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i <edge1.length; i++) {
            he += edge1[i];
        }
        kuka1 = (he * 1.0) / 30;
        System.out.println("生物化学的班级平均分为:" + kuka1);
        double Sum = 0;
        for (int i = 0; i < edge2.length; i++) {
            Sum += edge2[i];
        }
        kuka2 = (Sum * 1.0) / 30;
        System.out.println("物理化学的班级平均分为:" + kuka2);
        double sum = 0;
        for (int i = 0; i < edge3.length; i++) {
            sum += edge3[i];
        }
        kuka3 = (sum * 1.0) / 30;
        System.out.println("电子与电工技术的班级平均分为:" +kuka3);


        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i <edge1.length; i++) {
            c1 += (edge1[i] - kuka1) * (edge1[i] - kuka1);
        }
        moji1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:" + moji1);
        for (int i = 0; i < edge2.length; i++) {
            c2 += (edge2[i] -kuka2) * (edge2[i] - kuka2);
        }
        moji2 = Math.sqrt(c2*1.0/30);
        System.out.println("物理化学的班级标准差为:" +moji2);

        for (int i = 0; i < edge3.length; i++) {
            c3 += (edge3[i] -kuka3) * (edge3[i] - kuka3);
        }
        moji3 = Math.sqrt(c3*1.0/30);
        System.out.println("电子与电工技术的班级标准差为:" + moji3);
////
//
//
        Arrays.sort(edge1);
        Arrays.sort(edge2);
        Arrays.sort(edge3);
        diliu1 = (edge1[14] + edge2[15]) * 1.0 / 2;
        diliu2 = (edge2[14] + edge2[15]) * 1.0 / 2;
        diliu3 = (edge3[14] + edge3[15]) * 1.0 / 2;
        System.out.println("生物化学的中位数为:" + diliu1);
        System.out.println("物理化学的中位数为:" + diliu2);
        System.out.println("电子与电工技术的中位数为:" + diliu3);





    }
}
